//
// This case tests the methods seekWindow, setWindow, seekAndSetWindow
// Notice: To run this case successfully the IE browser must disable 
// "Reuse windows for launching shortcuts"
// in configuration menu tools->options->Advanced.
// Also: IE must be set as default browser: Tools>Internet Options>Programs>Make default.
//
function SeekWindowTest() {
    assimilate(this, new IeUnit());
    var cmdShell = new ActiveXObject("WScript.Shell");

    this.setUp = function() {
        cmdShell.Run("\"" + this.getCaseDir() +"\\" + "TestPage.html\"", 1, false);
	this._sleep(1000);
        cmdShell.Run("\"" + this.getCaseDir() +"\\" + "InputPage.html\"", 1, false);
	this._sleep(1000);
    };

    this.tearDown = function() {
        this.seekAndSetWindow("Test Page");
        this.closeWindow();
        this.seekAndSetWindow("Test Page");
        this.closeWindow();
    };

    this.testSeekFirst = function() {
        this.seekAndSetWindow("Test Page", true);
        this.assertPageHasText("Hello World!");
    };

    this.testSeekLast = function() {
        this.seekAndSetWindow("Test Page", false);
        this.assertPageHasText("Goto TestPage");

        this.seekAndSetWindow("Test Page");
        this.assertPageHasText("Goto TestPage");
    };
}
